import request from '@/utils/request'

const course_baseurl = '/serviceedu/course'
const teacher_baseurl = '/serviceedu/teacher'
const subject_baseurl = '/serviceedu/subject'

export default{
    //1 课程基本信息添加
    saveCourseInfo(courseInfo){
        return request({
            url: `${course_baseurl}/save`,
            method: 'post',
            data: courseInfo
        })
    },
    //查询所有讲师
    getTeacherList(){
        return request({
            url: `${teacher_baseurl}/findAll`,
            method: 'get'
        })
    },
    //课程分类列表
    getAllSubject(){
        return request({
            url: `${subject_baseurl}/getAllSubject`,
            method: 'get'
        })
    },
    //得到课程基本信息
    getCourseInfo(courseId){
        return request({
            url: `${course_baseurl}/getCourseInfo/${courseId}`,
            method: 'get'
        })
    },
    //更新课程信息
    update(courseInfo){
        return request({
            url: `${course_baseurl}/update`,
            method: 'post',
            data: courseInfo
        })
    },
    //根据ID获取课程发布信息
    getCoursePublishVoById(id){
        return request({
            url: `${course_baseurl}/getCoursePublishVoById/${id}`,
            method: 'get'
        })
    },
    //根据id发布课程
    publishCourse(id){
        return request({
            url: `${course_baseurl}/publishCourse/${id}`,
            method: 'post'
        })
    },
    //条件分页
    pageCondition(page,limit,courseQuery){
        return request({
            url: `${course_baseurl}/pageCondition/${page}/${limit}`,
            method: 'post',
            data: courseQuery
        })
    },
    //删除课程
    delete(id){
        return request({
            url: `${course_baseurl}/delete/${id}`,
            method: 'delete'
        })
    }
}